<?php
include('../config/config.php');
include('../../../config.inc');
include('../include/dbconnect.php');
//请勿重复运行此程序。
//
$query="select user_id,full_name,department from svnauth_user where (full_name != '') or (department != '')";
$result=mysql_query($query);
$i=0;
while (($result)and($row= mysql_fetch_array($result, MYSQL_BOTH))) {
	$full_name=$row['full_name'];
	$department=$row['department'];
	$user_id=$row['user_id'];
	$full_name=iconv("GB2312","UTF-8",$full_name);
	$department=iconv("GB2312","UTF-8",$department);
	$query="update svnauth_user set full_name='$full_name', department='$department' where user_id=$user_id";
	mysql_query($query);
	echo mysql_error();
	$i++;
	echo "<br>$i line data turn to utf-8!";
}
$query="select repository,path,des from dir_des";
$result=mysql_query($query);
$i=0;
while (($result)and($row= mysql_fetch_array($result, MYSQL_BOTH))) {
	$repos=$row['repository'];
	$path=$row['path'];
	$des=$row['des'];
	$des=iconv("GB2312","UTF-8",$des);
	$query="update dir_des set des='$des' where repository='$repos' and path='$path'";
	mysql_query($query);
	echo mysql_error();
}
unlink('./gbk2utf8.php');
